package com.mwh.yuantu.dao;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mwh.yuantu.dao.mapper.ReplyInfoMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mwh.yuantu.entity.ReplyInfoEntity;

/**
 * (ReplyInfo)表数据库访问层
 *
 * @author maweihong
 * @since 2023-11-01 09:47:31
 */
@Service
public class ReplyInfoDao extends ServiceImpl<ReplyInfoMapper , ReplyInfoEntity> {

    @Autowired
	private ReplyInfoMapper replyInfoMapper;

    /**
     * 插入新的回复
     * @param replyInfo
     * @return
     */
    public int insert(ReplyInfoEntity replyInfo){
        return replyInfoMapper.insert(replyInfo);
    }

    /**
     * 获取某个评论的回复列表
     * @param commentId 评论表主键
     * @return
     */
    public List<ReplyInfoEntity> listByCommentId(String commentId){
        return replyInfoMapper.listByCommentId(commentId);
    }

    /**
     * 获取某个视频的回复条数
     * @param videoId 视频主键
     * @return
     */
    public int countByVideoId(String videoId){
        return replyInfoMapper.countByVideoId(videoId);
    }

    /**
     * 删除回复表中的内容
     * @param userIdArr 用户id数组
     * @return
     */
    public int deleteByUserIdArr(@Param("userIdArr") String[] userIdArr){
        return replyInfoMapper.deleteByUserIdArr(userIdArr);
    }
}

